/**
 * Copyright &copy; 2012-2017 <a href="https://vivo.com">vivo</a> All rights reserved.
 */
package com.vivo.dealer.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.thinkgem.jeesite.common.persistence.Page;
import com.thinkgem.jeesite.common.service.CrudService;
import com.vivo.dealer.entity.ViUserDealerPrivilege;
import com.vivo.dealer.dao.ViUserDealerPrivilegeDao;

/**
 * 用户经销商权限Service
 * @author jyangye
 * @version 2018-02-07
 */
@Service
@Transactional(readOnly = true)
public class ViUserDealerPrivilegeService extends CrudService<ViUserDealerPrivilegeDao, ViUserDealerPrivilege> {

    @Autowired
    private ViUserDealerPrivilegeDao viUserDealerPrivilegeDao;

	public ViUserDealerPrivilege get(String id) {
		return super.get(id);
	}

	public List<ViUserDealerPrivilege> getListByUserId(String userId) {
	    ViUserDealerPrivilege query = new ViUserDealerPrivilege();
	    query.setUserId(userId);
	    return findList(query);
    }
	
	public List<ViUserDealerPrivilege> findList(ViUserDealerPrivilege viUserDealerPrivilege) {
		return super.findList(viUserDealerPrivilege);
	}
	
	public Page<ViUserDealerPrivilege> findPage(Page<ViUserDealerPrivilege> page, ViUserDealerPrivilege viUserDealerPrivilege) {
		return super.findPage(page, viUserDealerPrivilege);
	}
	
	@Transactional(readOnly = false)
    public void deleteByUserId(String userId) {
	    viUserDealerPrivilegeDao.deleteByUserId(userId);
    }


	@Transactional(readOnly = false)
    public void insertByBatch(List<ViUserDealerPrivilege> list) {
	    viUserDealerPrivilegeDao.insertByBatch(list);
    }

	@Transactional(readOnly = false)
	public void save(ViUserDealerPrivilege viUserDealerPrivilege) {
		super.save(viUserDealerPrivilege);
	}
	
	@Transactional(readOnly = false)
	public void delete(ViUserDealerPrivilege viUserDealerPrivilege) {
		super.delete(viUserDealerPrivilege);
	}
	
}